import type { RouteRecordRaw } from 'vue-router'
const baseViews: RouteRecordRaw[] = [  //基本的路由
    {
        name:'index',
        path: '/',
        component: () => import(/* webpackChunkName: "home" */ '@/views/index.vue'),
        meta: {keepAlive:true,title:'欢迎！'}  //本项目放弃对试用者的开放；如果已经登录，则强制跳转到chat/index
    },
    {
        name:'login',
        path: '/login',
        component: () => import(/* webpackChunkName: "home" */ '@/views/login/index.vue'),
        meta: {keepAlive:true,title:'登录AI'}  //本项目放弃对试用者的开放；如果已经登录，则强制跳转到chat/index
    },
    {
        name:'assistant',
        path: '/assistant',
        component: () => import(/* webpackChunkName: "home" */ '@/views/assistant/index.vue'),
        meta: {keepAlive:true,title:'浮窗助手'}  //本项目放弃对试用者的开放；如果已经登录，则强制跳转到chat/index
    },
    {
        name:'error',
        path: '/error/:code',
        component: () => import(/* webpackChunkName: "error" */ '@/views/error/index.vue'),
        props:true,
        meta: {keepAlive:true,title:'出错啦~'}
    },
    { path: '/:pathMatch(.*)*', redirect:'/error/404' },// 如果你省略了最后的 `*`，在解析或跳转时，参数中的 `/` 字符将被编码

]

const chatViews: RouteRecordRaw[] = [  //店铺模块的路由
    {
        path: '/chat',
        component: () => import(/* webpackChunkName: "home" */ '@/layout/chatLayer.vue'),
        meta: {keepAlive:true,title:'探索未知之境',routerViewKey: 'chat-page'},  //避免嵌套路由二级父组件重新渲染
        redirect:'/chat/ask',
        children:[
            {
                name:'chatView',
                path: '/chat/ask/:conversationId?',
                component: () => import(/* webpackChunkName: "home" */ '@/views/chat/conversation.vue'),
                props:true,
                meta: {title:'AI对话',routerViewKey: 'chat-page'}  //避免嵌套路由二级父组件重新渲染
            },
            {
                name:'toolCenter',
                path: '/chat/toolsCenter',
                component: () => import(/* webpackChunkName: "home" */ '@/views/tools/center.vue'),
                props:true,
                meta: {title:'AI工具集',keepAlive:true,routerViewKey: 'chat-page'}  //避免嵌套路由二级父组件重新渲染
            },
        ],
    },
]
export {
    baseViews,chatViews
};